using Android.Content;

using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using ZXXFAPP.Droid;
using ZXAPP;

[assembly: ExportRenderer(typeof(WebView), typeof(CustomWebViewRenderer))]
namespace ZXXFAPP.Droid
{
    public class CustomWebViewRenderer : WebViewRenderer
    {
        public CustomWebViewRenderer(Context context) : base(context)
        {
        }

        protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.SetWebViewClient(new CustomWebViewClient(Control));
                Control.SetWebChromeClient(new CustomWebChromeClient());
                Control.SetDownloadListener(new MyDownloadListener());
                Control.Settings.JavaScriptEnabled = true;
                Control.Settings.AllowFileAccess = true;
                Control.Settings.AllowContentAccess = true;
                
            }
        }
    }
}
